<script>
	//import './utils/mtj-wx-sdk.js';
	export default {
		onLaunch: function() {
		   if (!uni.getStorageSync('entryTime')) {
			   uni.setStorageSync('entryTime', new Date().getTime())
		   }
		},
		onShow: function(e) {
			let that = this
			console.log(e)
			if(e.scene==1037){
				if(e.referrerInfo.appId=="wx64f6b498a26dc59a"){
					wx.login({
						success(res){
							that.$api.post2('/auth/oauth/token',{
								code:res.code,
								grant_type:'wechat',
								captcha:'aaa',
								type:'1',
								mobile:e.referrerInfo.extraData.mobile
							},false).then(res=>{
								that.show = false;
								if(res.data.code===0){
									uni.setStorageSync('authorization',res.data.token_type+' '+res.data.access_token);
									uni.setStorageSync('access_token',res.data.access_token);
									that.$api.get('/sys/user/info').then(res2=>{
										if(res2.data.code===0){
											uni.setStorageSync('userInfo',JSON.stringify(res2.data.data));
											that.$showToast('登录成功');
											uni.setStorageSync('isLogin',true);
											that.$emit('loginSuccess',res2);
										}else that.$showToast(res2.data.msg)
									})
								}else that.$showToast(res.data.msg)
							})
						}
					})
				}
					
			}
			this.autoUpdate();
			//this.getDict();
		   if(uni.getStorageSync('userInfo')){
				uni.request({
					url: 'https://api.ipify.org?format=json',
					// url:" http://myip.ipip.net",
					success: (res) =>{
						uni.setStorageSync('userIp',res.data.ip);
					}
				});
		   }
		},
		methods: {
			autoUpdate() {
				if (wx.canIUse('getUpdateManager')) {
					const updateManager = wx.getUpdateManager();
					updateManager.onCheckForUpdate(res => {
						if (res.hasUpdate) {
							updateManager.onUpdateReady(() => {
								wx.showModal({
									title: '更新提示',
									content: '发现新版本，是否更新？',
									success: function(res) {
										if (res.confirm) {
											updateManager.applyUpdate();
										}
									}
								})
							});
							updateManager.onUpdateFailed(function() {
								wx.showModal({
									title: '最新版提示',
									content: '新版本已上线，请您删除当前小程序，重新搜索打开',
									showCancel: false
								})
							});
						}
					})
				} else {
					wx.showModal({
						title: '提示',
						content: '当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。',
						showCancel: false
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "@/uni_modules/uview-ui/index.scss";
	@import url("/components/u-parse/u-parse.css");

	* {
		padding: 0;
		margin: 0;
		box-sizing: border-box;
		font-family: PingFangSC-Regular, PingFang SC;
	}

	html,
	body {
		font-family: PingFangSC-Regular, PingFang SC;
		font-size: 24rpx;
		width: 100%;
		height: 100%;

		// 景点门票tab 滑块条位置
		.jd_orderList {
			background-color: #fff;

			.u-tabs__wrapper__nav__line {
				left: 40rpx !important
			}
		}

		//须知
		.must_know {
			.u-tabs__wrapper__nav__line {
				left: 30rpx !important
			}
		}
	}
</style>
<!-- tabbar样式修改 -->
<style lang="less">
	.pintr_info,.pc_item,.pin_info{
		.card{
			max-width: 330rpx;
		}
	}
	
	.u-tabbar__content,
	.u-tabbar__content__item-wrapper {
		border-top-left-radius: 36rpx;
		border-top-right-radius: 36rpx;
		box-shadow: 0rpx -2rpx 2rpx 2rpx #f5f5f5;
	}

	.u-tabbar-item {
		position: relative;

		&:nth-child(3) {
			.u-tabbar-item__icon {
				width: 106rpx !important;
				height: 106rpx !important;
				background: #fff;
				border-radius: 50%;
				position: absolute;
				top: -58rpx;

				image {
					width: 98rpx;
					height: 98rpx;
					position: absolute;
					top: -2rpx;
				}
			}

			.u-tabbar-item__text {
				margin-top: 52rpx;
			}
		}
	}
</style>

<style>
	.u-calendar-month__days__day {
		height: 104rpx !important;
	}

	.u-calendar__confirm .u-button {
		width: calc(100% - 24rpx) !important;
		height: 88rpx !important;
		background: #007A69 !important;
		border-radius: 44rpx !important;
	}

	.u-calendar__confirm .u-button text {
		font-size: 32rpx !important;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF !important;
	}

	.u-calendar scroll-view {
		height: 600rpx !important;
	}
	.u-popup__content__close .u-icon__icon {
		font-size: 28rpx !important;
	}
</style>